package com.kaifamiao.N0721;

import java.util.Arrays;

public class Node1 {
    public static void main(String[] args) {
        int[] num1 = {1,5,2,8,6,5,4,6,4,9,7};
        //
        //copyOf(被复制的数组，新数组的长度)
        int[] copy = Arrays.copyOf(num1,num1.length);
        for(int i = 0;i < num1.length;i++){
            System.out.print("\t"+copy[i]);
        }
        System.out.println();
        //当新数组长度大于被复制数组长度时，多出的位置用数组类型默认值填充
        int[] copy1 = Arrays.copyOf(num1,num1.length*2);
        for(int i = 0;i < copy1.length;i++) {
            System.out.print("\t" + copy1[i]);
        }
    }
}
